y: this._cursor.y * this._scale,
scale: this._cursorScale,
}
- );
+ ).catch(e => logError(e, 'Error capturing screenshot'));
} else if (this._windowButton.checked) {
const window =
this._windowSelectors.flatMap(selector => selector.windows())
y: window.cursorPoint.y * window.bufferScale,
scale: this._cursorScale,
}
- );
+ ).catch(e => logError(e, 'Error capturing screenshot'));
}
}
* @param {number} cursor.y - The cursor y coordinate.
* @param {number} cursor.scale - The cursor texture scale.
*/
-function captureScreenshot(texture, geometry, scale, cursor) {
+async function captureScreenshot(texture, geometry, scale, cursor) {
const stream = Gio.MemoryOutputStream.new_resizable();
const [x, y, w, h] = geometry ?? [0, 0, -1, -1];
if (cursor === null)
global.display.get_sound_player().play_from_theme(
'screen-capture', _('Screenshot taken'), null);
- Shell.Screenshot.composite_to_stream(
+ const pixbuf = await Shell.Screenshot.composite_to_stream(
texture,
x, y, w, h,
scale,
cursor.texture, cursor.x, cursor.y, cursor.scale,
stream
- ).then(pixbuf => {
- stream.close(null);
- _storeScreenshot(stream.steal_as_bytes(), pixbuf);
- }).catch(err => {
- logError(err, 'Error capturing screenshot');
- });
+ );
+
+ stream.close(null);
+ _storeScreenshot(stream.steal_as_bytes(), pixbuf);
}
/**